package com.ferryc.fegin;

import com.ferryc.fegin.hystrix.PayServiceFallbackFactory;
import com.ferryc.model.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by Ferry Chen on 2019/11/13.
 */
@FeignClient(name = "account-service", fallbackFactory = PayServiceFallbackFactory.class,path = "/account")
public interface PayFeignClient {
    @PostMapping("/add")
    public Result add(@RequestParam(value = "userId") String userId,
                      @RequestParam(value = "money", required = false) Double money);

    @PostMapping("/consume")
    public Result consume(@RequestParam(value = "userId") String userId,
                          @RequestParam(value = "money") Double money);

    @PostMapping("/update")
    public Result update(@RequestParam(value = "userId") String userId,
                         @RequestParam(value = "money") Double money);

    @PostMapping("/checkBalance")
    public Result checkBalance(@RequestParam(value = "userId") String userId,
                               @RequestParam(value = "money") Double money);
}
